package study.rocketmq.controller;

import com.google.common.collect.Lists;
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.client.producer.TransactionSendResult;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.apache.rocketmq.spring.support.RocketMQHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import study.rocketmq.stream.SpringCloudStreamSourceService;
import study.rocketmq.vo.Order;

import java.util.Arrays;
import java.util.List;
import java.util.UUID;

/**
 * @author juede.tcever
 */
@RestController
public class SpringCloudStreamController {

    @Autowired
    private SpringCloudStreamSourceService sourceService;

    @GetMapping(value = "/stream1")
    public String stream(String msg) {
        sourceService.send(msg);
        return "通过source发送消息成功，消息内容： " + msg;
    }
    @GetMapping(value = "/stream2")
    public String streamOrder(String orderId) {
        Order order = new Order(orderId,"广东");
        sourceService.send(order);
        return "通过source发送消息成功，消息内容： " + order;
    }

}
